package cn.shlbysj.demo.controller;

import cn.shlbysj.demo.common.PageResult;
import cn.shlbysj.demo.entity.ArtInfo;
import cn.shlbysj.demo.entity.NewsInfo;
import cn.shlbysj.demo.entity.OnlineExp;
import cn.shlbysj.demo.entity.VideoInfo;
import cn.shlbysj.demo.service.IArticleService;
import cn.shlbysj.demo.service.INewsInfoService;
import cn.shlbysj.demo.service.IOnlineExpService;
import cn.shlbysj.demo.service.IVideoInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import springfox.documentation.annotations.ApiIgnore;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
@ApiIgnore
public class UrlToPagesController {

    @Autowired
    private IArticleService articleService;
    @Autowired
    private IOnlineExpService onlineExpService;
    @Autowired
    private IVideoInfoService videoInfoService;
    @Autowired
    private INewsInfoService newsInfoService;

    @RequestMapping(value = "/index")
    public String index(HttpServletRequest request, Model model){
        //获取在线体验毕设的列表(6条)
        List<OnlineExp> oList=onlineExpService.getList();
        //获取视频的列表(6条)
        List<VideoInfo> vList=videoInfoService.getList();
        //获取资讯的列表(4条)
        List<NewsInfo> nList=newsInfoService.getList();
        //最新的毕设列表(6条)
        List<ArtInfo> list=articleService.findPage(null,null,0,6).getRows();
        //推荐的毕设列表(6条)
        List<ArtInfo> rList=articleService.getListFan();
        //热门的毕设列表(6条)
        List<ArtInfo> hList=articleService.getListHot();
        model.addAttribute("oList",oList);
        model.addAttribute("vList",vList);
        model.addAttribute("nList",nList);
        model.addAttribute("list",list);
        model.addAttribute("rList",rList);
        model.addAttribute("hList",hList);
        return "index";
    }
    @RequestMapping(value = "/prodctlist")
    public String prodctlist(HttpServletRequest request, org.springframework.ui.Model model){
        return "productlist";
    }
    @RequestMapping(value = "/downLoad")
    public String downLoad(HttpServletRequest request, org.springframework.ui.Model model){
        return "downLoad";
    }
    @RequestMapping(value = "/make")
    public String make(HttpServletRequest request, org.springframework.ui.Model model){
        return "make";
    }
    @RequestMapping(value = "/userGood")
    public String userGood(HttpServletRequest request, org.springframework.ui.Model model){
        return "userGood";
    }
    @RequestMapping(value = "/news")
    public String news(HttpServletRequest request, org.springframework.ui.Model model){
        return "news_list";
    }
}
